<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"  isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Store Display</title>
<style type="text/css">
	.hoverTap{
		font-size: 1.3em; color: red;
	}
</style>
</head>
<body>
	<h1>Welcome:${user.name }</h1>
	<div style="width:800px; height:800px; margin: 0 auto;">
		
		<div style="width:800px;height:80px;text-align:center;">
			<h3>Store Display</h3>
			<a href="product">返回添加商品页面</a><br>
			<hr>
		</div>
		<div style="width:800px;text-align:center; ">
			<div>
				<c:forEach items="${stores }" var="store">
					<c:choose>
						<c:when test="${sid == store.sid }">
							<a href="list?sid=${store.sid}" class="hoverTap" > ${store.address}</a>
						</c:when>
						<c:otherwise>
							<a href="list?sid=${store.sid}"> ${store.address}</a>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</div>
			
			<table style="text-align:center; margin:0 auto;">
				<tr>
					<th>Name</th>
					<th>Price</th>
					<th>Total</th>
					<th>Pd</th>
					<th>Update</th>
					<th>Delete</th>
				</tr>
				<c:forEach var="p" items="${products}">   
					<tr>
						<td>${p.name}</td>
						<td>${p.price }</td>
						<td>${p.total}</td>
						<td><fmt:formatDate value="${p.pd}" pattern="yyyy-MM-dd"/></td>
						<td><a href="update?pid=${p.pid }">Update</a></td>
						<td><a href="delete?pid=${p.pid }&sid=${sid}">Delete</a></td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		
	</div>
	
</body>
</html>